package com.sebastian.studies.ch9_MyPoint;

public class MyPoint {

	private int x;

	private int y;

	public MyPoint() {
		super();
		this.x = 0;
		this.y = 0;
	}

	public MyPoint(int x, int y) {
		super();
		this.x = x;
		this.y = y;
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	public double distance(MyPoint point1, MyPoint point2) {
		double distanceToSqr = ((point1.getX() - point2.getX()) * (point1.getX() - point2.getX()))
				+ ((point1.getY() - point2.getY()) * (point1.getY() - point2.getY()));
		double distance = Math.sqrt(distanceToSqr);
		return distance;
	}
}
